package com.zh.rxharmony.sample;

import com.zh.rxbus.RxBus;
import com.zh.rxharmony.sample.slice.MainAbilitySlice;
import com.zh.rxharmony.sample.util.HiLogUtil;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;

public class MainAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setMainRoute(MainAbilitySlice.class.getName());
        RxBus.getDefault().subscribe(this, "countDown", new RxBus.Callback<Integer>() {
            @Override
            public void onEvent(Integer time) {
                HiLogUtil.debug("倒计时剩余：" + time);
            }
        });
    }

    @Override
    protected void onStop() {
        super.onStop();
        RxBus.getDefault().unregister(this);
    }
}